home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacTech 1 to 12
/
MacTech-vol-1-12.toast
/
Tools
/
Alpha 6.51b13 ƒ
/
Tcl
/
Menus
/
internetConfigMenu.tcl
< prev
next >
Wrap
Text File
|
1996-11-20
|
4KB
|
167 lines
# nowrap
if $startingUp {
set icMenu "•139"
addMenu icMenu
return
}
set icMenu "•139"
proc icMenu {} {}
menu -n $icMenu -p internetProc {
"menu -n urls {}"
"/'<I<OpickUrl"
(-
goTo
help
(-
webBrowser
newsClient
mailClient
finger
"/ptelnet"
(-
ftpClient
gopherClient
telnetClient
(-
resolveUrl
viewHtmlFile
}
proc internetProc {menu item} {
global HOME
if {[catch {switch $item {
pickUrl icPickUrl
goTo icOpen
help {edit -r "$HOME:Help:Internet Config"}
webBrowser {launch -f [icGetPref -t 1 {helper•http}]}
mailClient {launch -f [icGetPref -t 1 {helper•mailto}]}
ftpClient {launch -f [icGetPref -t 1 {helper•ftp}]}
gopherClient {launch -f [icGetPref -t 1 {helper•gopher}]}
telnetClient {launch -f [icGetPref -t 1 {helper•telnet}]}
newsClient {launch -f [icGetPref -t 1 {helper•news}]}
resolveUrl {icURL [getSelect]}
viewHtmlFile htmlSendWindow
telnet {catch telnet}
finger {catch finger}
}}]} {
alertnote "Despite what Internet Config says, you should reboot after using IC for the first time."
launch -f "$HOME:Tools:Internet Config"
}
}
proc icPickUrl {} {
global savedUrls
if {![catch {listpick -p "Pick URL:" [lsort [array names savedUrls]]} res]} {
icURL $savedUrls($res)
}
}
proc rebuildUrlMenu {} {
global urlMenu savedUrls
menu -m -n urls -p urlProc {
"Add"
"View"
"Remove"
"(-"
}
foreach url [lsort -ignore [array names savedUrls]] {
addMenuItem -m -l " " urls $url
}
}
rebuildUrlMenu
# http://www.cs.umd.edu/~keleher/localHome.html
proc urlProc {menu item} {
global savedUrls modifiedArrVars
if {$item == "Add"} {
if {[catch getSelect def]} {set def {}}
set res [dialog -h 105 -w 370 -b OK 10 80 70 100 -b Cancel 100 80 160 100 -t {Name:} 10 10 60 30 -t {URL:} 10 40 60 60 -e "" 60 10 360 30 -e $def 60 40 360 60 ]
if {[lindex $res 0]} {
set nm [lindex $res 2]
set t [lindex $res 3]
if {![string length $t] || ![string length $nm]} {
beep
return
}
set savedUrls($nm) $t
lappend modifiedArrVars savedUrls
rebuildUrlMenu
}
} elseif {$item == "Remove"} {
set r [listpick -p "Remove which URL?" [lsort [array names savedUrls]]]
unset savedUrls($r)
removeArrDef savedUrls $r
rebuildUrlMenu
} elseif {$item == "View"} {
if {[info exists savedUrls]} {
set lines {}
foreach nm [array names savedUrls] {
append lines [format "%-20s \"%s\"\r" $nm [set savedUrls($nm)]]
}
new -n {* Saved URLs *}
insertText $lines
shrinkWindow
setWinInfo dirty 0
setWinInfo read-only 1
}
} else {
icURL [set savedUrls($item)]
}
}
if {![info exists lastFinger]} {set lastFinger ""}
if {![info exists lastTelnet]} {set lastTelnet ""}
proc finger {} {
global lastFinger modifiedVars
if {[catch {launchBackAppl {'PnLF'}}]} {
alertnote "You must install Peter Lewis's \"Finger\" program."
return
}
set lastFinger [prompt {Who?} $lastFinger]
lappend modifiedVars lastFinger
watchCursor
set text [AEBuild -r Finger GURL FURL ---- "“$lastFinger”"]
new -n "* $lastFinger *"
if {[regexp {“(.*)”} $text dummy text]} {
insertText $text
shrinkWindow
setWinInfo dirty 0
setWinInfo read-only 1
goto 0
}
}
proc telnet {} {
global lastTelnet modifiedVars
if {[catch {launchBackAppl {'NCSA'}}]} {
alertnote "You must install Telnet."
return
}
if {[string length $lastTelnet]} {
set choice [eval prompt {Where?} [car $lastTelnet] Old $lastTelnet ]
set lastTelnet [removeDups [concat $choice $lastTelnet]]
} else {
set choice [set lastTelnet [prompt {Where?} $lastTelnet]]
}
lappend modifiedVars lastTelnet
watchCursor
AEBuild -r Telnet GURL GURL ---- "“telnet://$choice”"
switchTo 'NCSA'
}